package com.inter.service.impl;

import com.inter.entity.common.OrderPaymentManager;
import com.inter.entity.common.OrderRefPackageManager;
import com.inter.entity.common.PartnerProductPackage;
import com.inter.entity.common.UserboundPaymentOrder;
import com.inter.mapper.OrderPaymentManagerMapper;
import com.inter.service.OrderPaymentManagerService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

@Service
@Transactional
public class OrderPaymentManagerServiceImpl implements OrderPaymentManagerService {
    @Resource
    OrderPaymentManagerMapper orderPaymentManagerMapper;

    @Override
    public Integer storageOrderPayment(OrderPaymentManager userOrder) {
        return orderPaymentManagerMapper.storageOrderPayment(userOrder);
    }

    @Override
    public void updateOrderIdByRequestOrderIdAndDeviceId(OrderPaymentManager user) {
        orderPaymentManagerMapper.updateOrderIdByRequestOrderIdAndDeviceId(user);
    }

    @Override
    public void updateIsOpenAndNotify(OrderPaymentManager userOrder) {
        orderPaymentManagerMapper.updateIsOpenAndNotify(userOrder);
    }

    @Override
    public List<OrderPaymentManager> getListToOpen() {

        return orderPaymentManagerMapper.getListToOpen();
    }

    @Override
    public int findOrderIdByNotify(String orderId) {
        return orderPaymentManagerMapper.findOrderIdByNotify(orderId);
    }

    @Override
    public void updatePayRst(OrderPaymentManager paymentOrder) {
        orderPaymentManagerMapper.updatePayRst(paymentOrder);
    }

    @Override
    public OrderPaymentManager queryOrderByOrderId(String orderId) {
        return orderPaymentManagerMapper.queryOrderByOrderId(orderId);
    }

    @Override
    public void updateIsNotify(OrderPaymentManager paymentOrder) {
        orderPaymentManagerMapper.updateIsNotify(paymentOrder);
    }

    @Override
    public List<OrderPaymentManager> getOrderResultsList(String orderId, String deviceId) {
        return orderPaymentManagerMapper.getOrderResultsList(orderId, deviceId);
    }

    @Override
    public void updateIsChannelNotity(OrderPaymentManager paymentOrder) {
        orderPaymentManagerMapper.updateIsChannelNotity(paymentOrder);
    }

    @Override
    public List<OrderPaymentManager> getChannelResultList() {
        return orderPaymentManagerMapper.getChannelResultList();
    }

    @Override
    public void insertRefPackage(OrderRefPackageManager ref) {
        orderPaymentManagerMapper.insertRefPackage(ref);
    }

    @Override
    public void UpdatePaypalNotify(UserboundPaymentOrder order) {
        orderPaymentManagerMapper.UpdatePaypalNotify(order);
    }

    @Override
    public Integer findDataByRequestOrderId(String requestOrderId, String deviceId, String orderPeriod, String partnerCode, String packageCode) {
        return orderPaymentManagerMapper.findDataByRequestOrderId(requestOrderId, deviceId, orderPeriod, partnerCode, packageCode);
    }

    @Override
    public PartnerProductPackage queryPackageByCode(String partnerCode, String packageCode) {
        return orderPaymentManagerMapper.queryPackageByCode(partnerCode,packageCode);
    }
}
